#include <QtOpenGL\QGLWidget>
#include <gl\GLU.h>
#include <vector>
#include <string>
using namespace std;
#include "Matrices.h"
#include "CalibrationData.h"
#include "CalibrationGfx.h"

CCalibrationGfx::CCalibrationGfx(CData* pData_/*=NULL*/ )
:CGfx(pData_)
{
    _pCalibrationData = dynamic_cast<CCalibrationData*>(pData_);
}

CCalibrationGfx::~CCalibrationGfx(void)
{
}

void CCalibrationGfx::updateObserver( int nCurrentFrame_ )
{
    glMatrixMode(GL_MODELVIEW);// switch to model view mode
    glLoadIdentity();// load a identity matrix
    gluLookAt(
        0,0,0,
        0,0,1,
        0,1,0
        ); 
    // Eye is on the xy plane the road is on xy-eyeheight. 
}

void CCalibrationGfx::updateStatus()
{
    //main loop
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    renderNormalView();
}

void CCalibrationGfx::renderObj()
{
    // render a white cross on the center of the screen.
    glEnable(GL_DEPTH_TEST);

    glColor3d(_pCalibrationData->crossColor()[0],_pCalibrationData->crossColor()[1],_pCalibrationData->crossColor()[2]);
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();

    glBegin(GL_LINES);
    glVertex3d(-_pCalibrationData->crossLength(),0,1);
    glVertex3d(_pCalibrationData->crossLength(),0,1);
    glEnd();

    glBegin(GL_LINES);
    glVertex3d(0,-_pCalibrationData->crossLength(),1);
    glVertex3d(0,_pCalibrationData->crossLength(),1);
    glEnd();

    glPopMatrix();
}

void CCalibrationGfx::LoadParametersFromScript()
{
    ;
}

void CCalibrationGfx::renderBirdView()
{
    ;
}

void CCalibrationGfx::updateBirdObserver( int nCurrentFrame_ )
{
    ;
}

void CCalibrationGfx::initDisplayList()
{
    ;
}